package com.example.android_timer;



import java.util.Timer;

import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Context;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    public void start_my_timer(View view){
		
    	Timer timer1 = new Timer();             // Get timer 1


    	long delay1 = 1 * 1000;                   // 5 seconds delay


    	// Schedule the two timers to run with different delays.
    	Task task = new Task("object1");
    	task.SetParentActivity(this);
    	timer1.schedule(task, 0, delay1);

    	
		
    	// display a toast message
    	Context context = getApplicationContext();
    	CharSequence text = "Start timer!";
    	int duration = Toast.LENGTH_SHORT;

    	Toast toast = Toast.makeText(context, text, duration);
    	toast.show();
    }
    
    public void finish_my_app (View view){
    	this.finish();
    }
}
